package com.example.securitydemo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;

/**
 * @author zhangyx
 * @desc
 * @date 2020/8/14 14:33
 **/
@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {

    //默认url根路径跳转到/login,此url为spring security提供

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("redirect:/login-view");
        registry.addViewController("/login-view").setViewName("login");
    }




    /**
     * 静态资源映射
     */
    /*@Override





    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        if (parkingProperties.getSwaggerOpen()) {
            // swagger
            registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
            registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
        }

        // 本应用
        registry.addResourceHandler("/assets/**").addResourceLocations("classpath:/assets/");
    }*/
}
